package com.xique.door.api;

import com.xique.common.core.constant.ServiceNameConstants;
import com.xique.common.core.domain.R;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.door.api.factory.RemoteWxLoginFallbackFactory;
import com.xique.door.api.model.LoginAppUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author shd
 * @create 2021/12/31 10:49
 */
@FeignClient(contextId = "RemoteWxLoginService", value = ServiceNameConstants.DOOR_BIZ_SERVICE, fallbackFactory = RemoteWxLoginFallbackFactory.class)
public interface RemoteWxLoginService {

    /**
     * 获取微信手机号
     *
     * @param code
     * @return com.xique.common.core.web.domain.AjaxResult
     * @author shd
     * @date 2022/4/14 13:44
     */
    @GetMapping("login/getPhone")
    R<String> getPhone(@RequestParam("code") String code);

    /**
     * 微信登录
     *
     * @param phone
     * @param code
     * @return com.xique.common.core.web.domain.AjaxResult
     * @author shd
     * @date 2022/4/14 15:38
     */
    @PostMapping("login")
    R<LoginAppUser> login(@RequestParam("phone") String phone, @RequestParam("code") String code);


    /**
     * 验证码登录
     *
     * @param phone
     * @param code
     * @return com.xique.common.core.web.domain.AjaxResult
     */
    @PostMapping("login/verificationCode")
    R<LoginAppUser> verificationCode(@RequestParam("phone") String phone, @RequestParam("code") String code);

    /**
     * 短信验证码获取
     *
     * @param phone
     * @return com.xique.common.core.web.domain.AjaxResult
     */
    @GetMapping("login/sendSmsCode")
    R<String> sendAuthCode(@RequestParam("phone") String phone);
}
